﻿Imports IntoNails.DataAccess
Imports IntoNails.Models

Namespace ViewModel
    Public Class EmployeeViewModel
        Inherits WorkspaceViewModel

#Region "Fields"
        Protected ReadOnly _repository As EmployeeRepository
        Protected _bindingEmployee As Employee
        Protected _isActive As Boolean
        Protected _isSelected As Boolean
#End Region

#Region "Constructors"

        Public Sub New(ByVal employee As Employee, _
                       ByVal repository As EmployeeRepository)
            _repository = repository
            _bindingEmployee = employee
        End Sub

#End Region

#Region "Properties"

        Private _code As Integer
        Public Property UniqueCode() As Integer
            Get
                Return _bindingEmployee.UniqueCode
            End Get
            Set(ByVal value As Integer)
                _code = value
            End Set
        End Property

        Private _fullName As String
        Public Property FullName() As String
            Get
                Return _bindingEmployee.FullName
            End Get
            Set(ByVal value As String)
                If value = _bindingEmployee.FullName Then
                    Return
                End If

                _bindingEmployee.FullName = value
                Me.OnPropertyChanged("FullName")
            End Set
        End Property

        Private _address As String
        Public Property Address() As String
            Get
                Return _bindingEmployee.Address
            End Get
            Set(ByVal value As String)
                If value = _bindingEmployee.Address Then
                    Return
                End If

                _bindingEmployee.Address = value
                Me.OnPropertyChanged("Address")
            End Set
        End Property

        Private _contactNumber As String
        Public Property ContactNumber() As String
            Get
                Return _bindingEmployee.ContactNumber
            End Get
            Set(ByVal value As String)
                If value = _bindingEmployee.ContactNumber Then
                    Return
                End If

                _bindingEmployee.ContactNumber = value
                Me.OnPropertyChanged("ContactNumber")
            End Set
        End Property

        Private _cellPhone As String
        Public Property CellPhone() As String
            Get
                Return _bindingEmployee.CellPhone
            End Get
            Set(ByVal value As String)
                If value = _bindingEmployee.CellPhone Then
                    Return
                End If

                _bindingEmployee.CellPhone = value
                Me.OnPropertyChanged("CellPhone")
            End Set
        End Property



        Private _valid As Boolean
        Public Property IsValid() As Boolean
            Get
                Return _bindingEmployee.IsValid
            End Get
            Set(ByVal value As Boolean)
                If value = _bindingEmployee.IsValid Then
                    Return
                End If

                _bindingEmployee.IsValid = value
                Me.OnPropertyChanged("IsValid")
            End Set
        End Property

        Protected _active As Boolean
        Public Property IsActive() As Boolean
            Get
                Return _active
            End Get
            Set(ByVal value As Boolean)
                If value = _active Then
                    Return
                End If

                _active = value
                Me.OnPropertyChanged("IsActive")
            End Set
        End Property

#End Region

    End Class
End Namespace